package com.stoken.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.stoken.dao.MemberAgentsListDao;
import com.stoken.domain.MemberAgentsList;
import com.stoken.service.MemberAgentsListService;
import com.symbio.commons.Page;
import com.symbio.dao.hibernate.GenericDaoImpl;
import com.symbio.service.impl.AbstractServiceImpl;

@Service
public class MemberAgentsListServiceImpl extends AbstractServiceImpl<MemberAgentsList, Long> implements MemberAgentsListService{
	
    @Autowired
	private MemberAgentsListDao MemberAgentsListDao;
    
	@Override
	public GenericDaoImpl<MemberAgentsList, Long> getDao() {		
		return MemberAgentsListDao;
	}

	@Override
	public boolean checkParentAgent(String parentName) {
		String hql = "from MemberAgentsList where baseUsername.baseUsername = ? and progressRate = 1";
		MemberAgentsList agent = (MemberAgentsList)MemberAgentsListDao.find(hql, new Object[]{parentName});
		return agent != null;
	}

	@Override
	public Page<MemberAgentsList> find(Page<MemberAgentsList> pageData) {
	
		return MemberAgentsListDao.find(pageData);
	}
}
